package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.domain.entity.Company;
import com.ruoyi.common.core.domain.entity.Leftover;
import com.ruoyi.common.core.domain.entity.Series;
import com.ruoyi.common.core.domain.entity.Stock;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.system.mapper.CompanyMapper;
import com.ruoyi.system.mapper.LeftoverMapper;
import com.ruoyi.system.service.ICompanyService;
import com.ruoyi.system.service.ILeftoverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class CompanyServiceImpl implements ICompanyService {

    @Autowired
    private CompanyMapper companyMapper;


    @Override
    public List<Company> selectCompanyList(Company company) {
        return companyMapper.selectCompanyList(company);
    }

    @Override
    public Company selectCompanyByTableId(String tableId) {
        return companyMapper.selectCompanyByTableId(tableId);
    }

    @Override
    @Transactional
    public int updateCompany(Company company) {
        return companyMapper.updateCompany(company);
    }

    @Override
    public List<Company> selectAllMaterial() {
        return companyMapper.selectAllMaterial();
    }

    @Override
    public int insertCompany(Company company) {
        company.setTableId(UUID.randomUUID().toString());
        company.setCompanyId(UUID.randomUUID().toString());
        return companyMapper.insertCompany(company);
    }

    @Override
    public int deleteCompanyById(String id) {
        return companyMapper.deleteCompanyById(id);
    }

    @Override
    public List<Stock> handleData() {
        return companyMapper.selectStock();
    }
}
